#ifndef Metric_First
#define Metric_First
#ifdef __GNUG__
#pragma interface
#endif

#include "Point.h"

//---- Metric ------------------------------------------------------------------

class Metric {
public:
	Metric();
	Metric(const Point &e, int b);
	Metric(const Point &e);
	Metric(int w);
	Metric(int w, int h);           
	Metric(int w, int h, int b);
	Metric(const Metric&);

	Point Extent() const;
	int Width() const;
	int Height() const;
	int Base() const;
		
	Metric Inset(const Point&);
	Metric Expand(const Point&);

	Metric Merge(const Metric&);
	Metric Cat(Direction d, const Metric &m, const Point &gap);

	friend Metric HCat(const Metric&, const Metric&, int hgap= 0);
	friend Metric VCat(const Metric&, const Metric&, int vgap= 0);
	friend Metric Cat(Direction d, const Metric&, const Metric&, const Point &gap);

	friend bool operator== (const Metric &m1, const Metric &m2);
	friend bool operator!= (const Metric &m1, const Metric &m2);

	friend Metric Min (const Metric&, const Metric&);
	friend Metric Max (const Metric&, const Metric&);

	friend OStream& operator<< (OStream &s, const Metric &p);
	friend IStream& operator>> (IStream &s, Metric &p);

public:
	Point extent;
	int base;
};

SimpleMetaDef(Metric);

inline bool operator== (const Metric &m1, const Metric &m2)
	{ return (bool) (m1.extent == m2.extent && m1.base == m2.base); }
inline bool operator!= (const Metric &m1, const Metric &m2)
	{ return (bool) (m1.extent != m2.extent && m1.base != m2.base); }
inline Point Metric::Extent() const
	{ return extent; }      
inline int Metric::Width() const
	{ return extent.x; }    
inline int Metric::Height() const
	{ return extent.y; }    
inline int Metric::Base() const
	{ return base; }

#endif
